From 28807cd2684f0c080999be21aa818824aaaca898 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 3 Sep 2009 07:37:27 +0100 Subject: [PATCH] x86: com devices's irqaction shouldn't free. Since irqs of serial devices are initialized in early Xen and its irqaction is not allocated from heap, so doesn't need free in release irq logic. Signed-off-by: Xiantao Zhang Signed-off-by: Keir Fraser --- xen/arch/x86/irq.c | 3 ++- xen/include/xen/irq.h | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index e547a7b9c8..eabce3b3e1 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -537,6 +537,7 @@ int request_irq(unsigned int irq, action->handler = handler; action->name = devname; action->dev_id = dev_id; + action->free_on_release = 1; retval = setup_irq(irq, action); if (retval) @@ -564,7 +565,7 @@ void release_irq(unsigned int irq) /* Wait to make sure it's not being used on another CPU */ do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS ); - if (action) + if (action && action->free_on_release) xfree(action); } diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h index b16d62e90c..58bf9f0535 100644 --- a/xen/include/xen/irq.h +++ b/xen/include/xen/irq.h @@ -7,11 +7,11 @@ #include #include -struct irqaction -{ +struct irqaction { void (*handler)(int, void *, struct cpu_user_regs *); const char *name; void *dev_id; + bool_t free_on_release; }; /* @@ -63,10 +63,8 @@ struct irq_cfg; * This is the "IRQ descriptor", which contains various information * about the irq, including what kind of hardware handling it has, * whether it is disabled etc etc. - * - * Pad this out to 32 bytes for cache and indexing reasons. */ -typedef struct irq_desc{ +typedef struct irq_desc { unsigned int status; /* IRQ status */ hw_irq_controller *handler; struct msi_desc *msi_desc; -- 2.30.2